<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/ceca_two/lib/layui/css/layui.css"  media="all">
    <style type="text/css">
        .layui-form-checked span, .layui-form-checked:hover span{
            background-color:#FF0000!important;
        }
        #demoBtn{
            background-color: #FF0000;
        }
        .layui-form-checked i, .layui-form-checked:hover i {
            color: #ff0000!important;
        }
        .layui-form-checked, .layui-form-checked:hover {
            border-color: #ff0000!important;
        }
        .layui-laydate-content td.laydate-selected {
            background-color: #f391a9!important;
            color: #ffffff;
        }
    </style>
</head>
<body  style="margin-left:auto;margin-right:auto;width: 80%;">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;text-align: center;">
    <legend style="display: inline-block;">查询每平米消耗量</legend>
</fieldset>
<form class="layui-form layui-form-pane" action="" >
  <div class="layui-form-item">
    <label class="layui-form-label">工程地点</label>
    <div class="layui-input-block" style="width: 190px;">
      <select name="address1" lay-filter="aihao">
        <option value=""></option>
        <option value="北京市">北京市</option>
        <option value="天津市">天津市</option>
        <option value="河北省">河北省</option>
        <option value="山西省">山西省</option>
        <option value="内蒙古自治区">内蒙古自治区</option>
         <option value="辽宁省">辽宁省</option>
         <option value="吉林省">吉林省</option>
         <option value="黑龙江省">黑龙江省</option>
         <option value="上海市">上海市</option>
         <option value="江苏省">江苏省</option>
         <option value="浙江省">浙江省</option>
         <option value="安徽省">安徽省</option>
         <option value="福建省">福建省</option>
         <option value="江西省">江西省</option>
         <option value="山东省">山东省</option>
         <option value="河南省">河南省</option>
         <option value="湖北省">湖北省</option>
         <option value="湖南省">湖南省</option>
         <option value="广东省">广东省</option>
         <option value="广西壮族自治区">广西壮族自治区</option>
         <option value="海南省">海南省</option>
         <option value="重庆市">重庆市</option>
         <option value="四川省">四川省</option>
         <option value="贵州省">贵州省</option>
         <option value="云南省">云南省</option>
         <option value="西藏自治区">西藏自治区</option>
         <option value="陕西省">陕西省</option>
         <option value="甘肃省">甘肃省</option>
         <option value="青海省">青海省</option>
         <option value="宁夏回族自治区">宁夏回族自治区</option>
         <option value="新疆维吾尔自治区">新疆维吾尔自治区</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">编制时间</label>
    <div class="layui-input-inline">
      <input type="text" name="compilationTime" id="compilationTime" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">工程分类</label>
    <div class="layui-input-inline">
      <select id="catalogOne" lay-filter="catalogOne" name="catalogOne">
      </select>
    </div>
    <div class="layui-input-inline" style="margin-right: 0;">
      <select id="catalogTwo" name="catalogTwo"></select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">结构类型</label>
    <div class="layui-input-block" style="width: 190px;">
      <select name="structureType" lay-filter="aihao">
        <option value=""></option>
				<option value="框架结构">框架结构</option>
				<option value="剪力墙结构">剪力墙结构</option>
				<option value="框架-剪力墙结构">框架-剪力墙结构</option>
				<option value="筒体结构">筒体结构</option>
				<option value="部分框支剪力墙结构">部分框支剪力墙结构</option>
				<option value="板柱-剪力墙结构">板柱-剪力墙结构</option>
				<option value="钢结构">钢结构</option>
				<option value="砖混结构">砖混结构</option>
				<option value="其他结构">其他结构</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">检索条件:</label>
    <div class="layui-input-block">
      <input type="text" name="code" id="code" autocomplete="off" placeholder="请输入清单编码前9位或分部分项名称" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item" style="margin-top: 50px; margin-left:auto;margin-right:auto;width: 10%;">
    <button class="layui-btn" lay-submit="" lay-filter="go" id="demoBtn">搜索</button>
  </div>
</form>
<script src="/ceca_two/lib/layui2.26/layui.js"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
	var form = layui.form
  ,layer = layui.layer
  ,laydate = layui.laydate;
  var $ =layui.jquery;
  var catalogData =[];
	$.ajax({
		    type:"post",
		    url:"/guidance_service/front/data/catalog/getCatalogs.do",
		    success : function (result){
		        if (result.resultCode === 200){
		        	  catalogData = result.data;
		        	  var html='<option value=""></option>';
	              for ( i = 0 ; i < catalogData.length ; i++){
	                if(catalogData[i].parentId =='1'){
		        	      html +='<option value="'+catalogData[i].catalogName+'_'+catalogData[i].catalogId+'">'+catalogData[i].catalogName+'</option>';
	                }
	              }
	              $("#catalogOne").html(html);
	              form.render("select");
		        }
		    }
	});
	form.on('select(catalogOne)', function(data){
	   var value = data.value;
		 var html='<option value=""></option>';
		 for ( i = 0 ; i < catalogData.length ; i++){
        if(catalogData[i].parentId ==value.split("_")[1]){
    	    html +='<option value="'+catalogData[i].catalogName+'_'+catalogData[i].catalogId+'">'+catalogData[i].catalogName+'</option>';
        }
     }
		 $("#catalogTwo").html(html);
	   form.render("select");
	});      
	laydate.render({
      elem: '#compilationTime',type: 'date',range: true,theme : "#ff3030"
  });
  form.on('submit(go)', function(data){
		  console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
		  console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
		  console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
		  makeUrl(data.field);
    return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	});
	function makeUrl(obj){
	    var searchUrl = "/ceca_two/modules/costnorm/searchListMeter.html?";
	    obj.structureType ? searchUrl+="&structureType="+window.btoa(encodeURI(obj.structureType )): "" ;
	    obj.catalogOne ? searchUrl+="&catalogOne="+window.btoa(encodeURI(obj.catalogOne)) : "" ;
	    obj.catalogTwo ? searchUrl+="&catalogSecond="+window.btoa(encodeURI(obj.catalogTwo)) : "" ;
	    obj.address1 ? searchUrl+="&address1="+window.btoa(encodeURI(obj.address1 )) : "" ;
	    obj.compilationTime ? searchUrl+="&compilationTime="+window.btoa(encodeURI(obj.compilationTime )) : "" ;
	    obj.code ? searchUrl+="&code="+window.btoa(encodeURI(obj.code )) : "" ;
	    parent.location.href = searchUrl;
	}
});
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?1c487e541b5a7a8cfbc2524a4a77512c";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>